<?php get_sidebar(); ?>
<?php
//get total images
$images=bandit::get_post_images();
// get category
$terms=array_values(get_the_terms($post->ID,'portfolio_category'));
?>
<div id="right" class="t-portfolio single style-3">
	
	<header id="header">
		<div id="header-inner">			
			<h2><?php bandit::lang('heading_portfolio',__('Portfolio','creatic')); ?></h2>
			<ul id="button-menu" class="clearfix">
				<li><a class="back" href="<?php echo get_term_link($terms[0]); ?>"><?php bandit::lang('portfolio_button_goback',__('&larr; Go Back','creatic')); ?></a></li>
			</ul>
		</div><!--end header-inner-->
	</header><!--end header-->
	
	<h1 id="page-heading"><span class="max-width"><?php the_title(); ?></span></h1>	
	<div id="content">
		<div id="content-inner" class="container-8">
			<div id="content-pad">
			
				<div id="grid-wrap-full">
					<div class="grid-full">
					
					<article class="item" id="item-<?php the_ID(); ?>">
						<?php if(count($images) > 1): ?>
						<script type="text/javascript">
							jQuery(document).ready(function($){
								$(".slider-gallery").slides({
									preload: true,
									preloadImage: '<?php echo get_template_directory_uri(); ?>/img/loading.gif',
									next: '#slide-next',
									prev: '#slide-prev',
									generatePagination: true,
									play: 7000,
									effect: 'fade',
									autoHeight: true,
									hoverPause: true,
									crossfade: true
								});
							});
						</script>

						<div class="item-img">
							<div class="slider-gallery">
								<div id="slide-prev"></div>
								<div id="slide-next"></div>
								<div class="slides_container clearfix">
									<?php foreach($images as $image): ?>
										<?php $image=wp_get_attachment_image_src($image->ID,'large'); ?>
										<div>
											<img src="<?php echo $image[0]; ?>" width="<?php echo $image[1]; ?>" height="<?php echo $image[2]; ?>" alt="<?php echo $image->post_title; ?>" />
										</div>
									<?php endforeach; ?>
								</div>
							</div>
						</div>

						<?php else: ?>

						<?php 
						// Get image ID
						$image_id=get_post_thumbnail_id();
						// Get image details
						if($image_id) {
							$image=wp_get_attachment_image_src($image_id,'full');
							$image_alt=get_the_title($image_id);
						}
						?>
						<div class="item-img">
							<img src="<?php echo $image[0]; ?>" width="<?php echo $image[1]; ?>" height="<?php echo $image[2]; ?>" alt="<?php echo $image_alt; ?>" />
						</div>
						<?php endif; ?>
						<div class="item-content clearfix">
							<ul class="entry-meta clearfix">
								<li class="time"><i class="icon"></i><?php the_time('F j, Y'); ?></li>
								<li class="like-count"><a id="like-<?php the_ID(); ?>" href="#" <?php bandit::liked_class();?>>
									<i class="icon"></i><?php bandit::post_liked_count(); ?></a>
								</li>
								<?php edit_post_link('<i class="icon"></i>Edit', '<li class="edit">', '</li>'); ?>
							</ul>
						</div>
					</article>
					<div id="page-description">	
						<?php the_content(); ?>	
					</div>
					</div><!--end grid-full-->		
				</div><!--end grid-wrap-full-->
				
				<div class="clear"></div>
			</div><!--end content-pad-->
			<?php if(bandit::get_option('footer_widgets')) { get_template_part('footer-widgets'); } // footer-widgets.php ?>
		</div><!--end content-inner-->
		<div class="clear"></div>
	</div><!--end content-->
	
</div><!--end right-->